home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / stat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  3.5 KB  |  147 lines

  1. /*  stat.h
  2.  
  3.     Definitions used for file status functions
  4. */
  5.  
  6. /*
  7.  *      C/C++ Run Time Library - Version 9.0
  8.  *
  9.  *      Copyright (c) 1987, 1998 by Borland International
  10.  *      All Rights Reserved.
  11.  *
  12.  */
  13. /* $Revision:   9.3  $ */
  14.  
  15. #if !defined(__STAT_H)
  16. #define __STAT_H
  17.  
  18. #if !defined(___DEFS_H)
  19. #include <_defs.h>
  20. #endif
  21.  
  22. #if !defined(__TYPES_H)
  23. #include <sys/types.h>
  24. #endif
  25.  
  26. #ifndef _WCHAR_T_DEFINED
  27. typedef unsigned short wchar_t;
  28. #define _WCHAR_T_DEFINED
  29. #endif
  30.  
  31. /* Traditional names for bits in st_mode.
  32.  */
  33. #define S_IFMT   0xF000  /* file type mask */
  34. #define S_IFDIR  0x4000  /* directory */
  35. #define S_IFIFO  0x1000  /* FIFO special */
  36. #define S_IFCHR  0x2000  /* character special */
  37. #define S_IFBLK  0x3000  /* block special */
  38. #define S_IFREG  0x8000  /* or just 0x0000, regular */
  39. #define S_IREAD  0x0100  /* owner may read */
  40. #define S_IWRITE 0x0080 /* owner may write */
  41. #define S_IEXEC  0x0040  /* owner may execute <directory search> */
  42.  
  43. /* POSIX file type test macros.  The parameter is an st_mode value.
  44.  */
  45. #define S_ISDIR(m)  ((m) & S_IFDIR)
  46. #define S_ISCHR(m)  ((m) & S_IFCHR)
  47. #define S_ISBLK(m)  ((m) & S_IFBLK)
  48. #define S_ISREG(m)  ((m) & S_IFREG)
  49. #define S_ISFIFO(m) ((m) & S_IFIFO)
  50.  
  51. /* POSIX names for bits in st_mode.
  52.  */
  53. #define S_IRWXU  0x01c0 /* RWE permissions mask for owner */
  54. #define S_IRUSR  0x0100 /* owner may read */
  55. #define S_IWUSR  0x0080 /* owner may write */
  56. #define S_IXUSR  0x0040 /* owner may execute <directory search> */
  57.  
  58. #if !defined(_RC_INVOKED)
  59. #pragma option push -a1
  60. #endif
  61.  
  62. struct  stat
  63. {
  64.     dev_t   st_dev;
  65.     ino_t   st_ino;
  66.     mode_t  st_mode;
  67.     nlink_t st_nlink;
  68.     uid_t   st_uid;
  69.     gid_t   st_gid;
  70.     dev_t   st_rdev;
  71.     off_t   st_size;
  72.     _TIME_T  st_atime;
  73.     _TIME_T  st_mtime;
  74.     _TIME_T  st_ctime;
  75. };
  76.  
  77. #if !defined(__STDC__) && (__BORLANDC__  >= 0x0520)
  78. struct  stati64
  79. {
  80.     dev_t   st_dev;
  81.     ino_t   st_ino;
  82.     mode_t  st_mode;
  83.     nlink_t st_nlink;
  84.     uid_t   st_uid;
  85.     gid_t   st_gid;
  86.     dev_t   st_rdev;
  87.     __int64 st_size;
  88.     _TIME_T  st_atime;
  89.     _TIME_T  st_mtime;
  90.     _TIME_T  st_ctime;
  91. };
  92. #endif
  93.  
  94. #if !defined(_RC_INVOKED)
  95. #pragma option pop
  96. #endif
  97.  
  98. #ifdef __cplusplus
  99. extern "C" {
  100. #endif
  101. int  _RTLENTRY _EXPFUNC fstat(int __handle, struct stat _FAR *__statbuf);
  102. int  _RTLENTRY _EXPFUNC _wstat(const wchar_t *__path, struct stat *__statbuf);
  103. int  _RTLENTRY _EXPFUNC _stati64(const char *__path, struct stati64 *__statbuf);
  104. int  _RTLENTRY _EXPFUNC _wstati64(const wchar_t *__path, struct stati64 *__statbuf);
  105. int  _RTLENTRY _EXPFUNC _stat(const char _FAR *__path, struct stat _FAR *__statbuf);
  106. #if !defined(__STDC__) && (__BORLANDC__  >= 0x0520)
  107. int  _RTLENTRY _EXPFUNC stat(const char *__path, struct stat _FAR *__statbuf);
  108. #endif  /* __STDC__ && __BORLANDC__ */
  109.  
  110. #ifdef __MSC
  111.  
  112. /* Define MS compatible names
  113. */
  114. #define _S_IFMT   S_IFMT
  115. #define _S_IFDIR  S_IFDIR
  116. #define _S_IFIFO  S_IFIFO
  117. #define _S_IFCHR  S_IFCHR
  118. #define _S_IFBLK  S_IFBLK
  119. #define _S_IFREG  S_IFREG
  120. #define _S_IREAD  S_IREAD
  121. #define _S_IWRITE S_IWRITE
  122. #define _S_IEXEC  S_IEXEC
  123.  
  124. #define _fstat(h,b) fstat(h,(struct stat *)b)
  125. #define _stat(p,b)   stat(p,(struct stat *)b)
  126. struct  _stat
  127. {
  128.     short st_dev;
  129.     short st_ino;
  130.     short st_mode;
  131.     short st_nlink;
  132.     int   st_uid;
  133.     int   st_gid;
  134.     short st_rdev;
  135.     long  st_size;
  136.     long  st_atime;
  137.     long  st_mtime;
  138.     long  st_ctime;
  139. };
  140. #endif
  141.  
  142. #ifdef __cplusplus
  143. }
  144. #endif
  145.  
  146. #endif  /* __STAT_H */
  147.